"""
This is just a sample code.

LevelEditor, ObjectHandler, ObjectPalette should be rewritten
to be game specific.
"""

import os
import wx
from .LevelEditorUI import LevelEditorUI
from .LevelEditorBase import LevelEditorBase
from .ObjectMgr import ObjectMgr
from .AnimMgr import AnimMgr
from .ObjectHandler import ObjectHandler
from .ObjectPalette import ObjectPalette
from .ProtoPalette import ProtoPalette

class LevelEditor(LevelEditorBase):
    """ Class for Panda3D LevelEditor """
    def __init__(self):
        LevelEditorBase.__init__(self)

        # define your own config file similar to this
        self.settingsFile = os.path.dirname(__file__) + '/LevelEditor.cfg'

        # If you have your own ObjectPalette and ObjectHandler
        # connect them in your own LevelEditor class
        self.objectMgr = ObjectMgr(self)
        self.animMgr = AnimMgr(self)
        self.objectPalette = ObjectPalette()
        self.objectHandler = ObjectHandler(self)
        self.protoPalette = ProtoPalette()

        # Populating uderlined data-structures
        self.ui = LevelEditorUI(self)
        self.ui.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
        self.objectPalette.populate()
        self.protoPalette.populate()

        # Updating UI-panels based on the above data
        self.ui.objectPaletteUI.populate()
        self.ui.protoPaletteUI.populate()

        # When you define your own LevelEditor class inheriting LevelEditorBase
        # you should call self.initialize() at the end of __init__() function
        self.initialize()
        self.ui.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
